library(ExPosition)
#from pseudo to real code.
#make both versions: long and short

##start with words. Change to something else...



#Get data
data(words)


#todays data
todays.data <- as.matrix(words$data)

#Create I x I matrix
D <- matrix(0,nrow(todays.data),nrow(todays.data))

#start the first loop.
for(f in 1:(nrow(todays.data)-1)){
	
	row.f <- todays.data[f,]
#	print(paste("ROW ",f,paste("FIRST LOOP: ",row.f,sep=""),sep=" "))
	for(s in (f+1):nrow(todays.data)){
		
		row.s <- todays.data[s,]
#		print(paste("ROW ",s,paste("SECOND LOOP: ",row.s,sep=""),sep=" "))
		dfs <- 0
		for(j in 1:ncol(todays.data)){
			#this is a stupid nuance of R.
			#print(paste('df changes',dfs,'with changes in j',j,sep=" "))			
			dfs <- dfs + (abs(row.f[j]-row.s[j]))
		}
		#print(paste('dfs final:',dfs,sep=" "))
		D[f,s] <- dfs
		D[s,f] <- dfs		
	}
	
}
